<?php

/**
 * LoginForm class.
 * LoginForm is the data structure for keeping
 * user login form data. It is used by the 'login' action of 'SiteController'.
 */
class RegisterForm extends CFormModel
{
	public $username;
	public $password1;
	public $password2; 
	public $name;
	public $accept_terms;

	/**
	 * Declares the validation rules.
	 * The rules state that username and password are required,
	 * and password needs to be authenticated.
	 */
	public function rules()
	{
		return array(
			array('username, password1, password2', 'required'),
			array('username', 'email'),
			array('username', 'unique', 'allowEmpty' => false, 'className' => 'User', 'attributeName' => 'email'),
			array('password2', 'compare', 'compareAttribute' => 'password1'),
			array('name', 'safe'),
			array('name', 'length', 'allowEmpty' => true, 'max' => 25, 'tooLong' => 'Maximum is 25 characters'),
			array('accept_terms', 'compare', 'compareValue' => true, 'message' => 'You must check this checkbox to accept the EULA.' ),
		);
	}

	/**
	 * Declares attribute labels.
	 */
	public function attributeLabels()
	{
		return array(
			'username' => t('Email'),
			'password1' => t('Password'),
			'password2' => t('Confirm Password'), 
			'name'		=> t('Name'),
		);
	}
}
